<?php

/**
 * 订单列表
 */

namespace app\sale\common;

class OrderCommon extends \app\sale\common\SaleCommon {


    protected function index() {
        $this->pageInfo['name'] = '返利记录';
        $this->setMeta('返利记录');
        $this->setCrumb([
            [
                'name' => '返利记录',
                'url' => url()
            ]
        ]);
        $urlParam = [];
        $where = [];
        $type = request('get', 'type', 0, 'intval');
        $urlParam['type'] = $type;
        switch ($type) {
            case 1:
                $where['A.sale_status'] = 1;
                break;
            case 2:
                $where['A.sale_status'] = 2;
                break;
            case 3:
                $where['A.sale_status'] = 0;
                break;
        }

        $pageLimit = 10;
        $where['A.user_id'] = $this->userInfo['user_id'];

        $model = target('sale/SaleOrder');
        $count = $model->countList($where);
        $pageData = $this->pageData($count, $pageLimit, $urlParam);
        $list = $model->loadList($where, $pageData['limit'], 'create_time desc, id desc');

        $this->assign('page', $pageData['html']);
        $this->assign('pageList', $list);
        $this->assign('pageParams', $urlParam);
        $this->assign('type', $type);
        $this->memberDisplay();
    }


}